package org.zfes.snowier.cloud.zbss.cms.router.service.content;

import java.util.Map;
import java.util.Optional;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.cloud.zbss.cms.content.model.CmsContentGroupView;
import org.zfes.snowier.cloud.zbss.cms.content.service.ICmsContentGroupViewService;
@Controller("org.zfes.snowier.cloud.zbss.cms.router.service.content.CmsContentGroupViewController") 
@RequestMapping("/cms/service/content/cmsContentGroupView")
public class CmsContentGroupViewController extends BaseController {

	
	@Autowired
	private ICmsContentGroupViewService cmsContentGroupViewService;
	
	@RequiresPermissions(value="cmsContentGroupView:loadCmsContentGroupViewDataSet",desc="内容用户组浏览配置列表")
    @RequestMapping(value="/loadCmsContentGroupViewDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsContentGroupViewDataSet(@RequestParam Map<String,Object> params){
	    DataSet dataSet=  cmsContentGroupViewService.loadCmsContentGroupViewDataSet(params);
	    return ajaxQuery("dataSet", dataSet);
    }
	
	@RequiresPermissions(value="cmsContentGroupView:createCmsContentGroupView",desc="内容用户组浏览配置添加")
    @RequestMapping(value="/createCmsContentGroupView", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public  @ResponseBody Object createCmsContentGroupView(CmsContentGroupView cmsContentGroupView){
		cmsContentGroupViewService.createCmsContentGroupView(cmsContentGroupView);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsContentGroupView:loadCmsContentGroupView",desc="内容用户组浏览配置加载")
    @RequestMapping(value="/loadCmsContentGroupView", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsContentGroupView(Long id){
		Optional<CmsContentGroupView> ops = cmsContentGroupViewService.loadCmsContentGroupViewById(id);
		return ajaxQuery("cmsContentGroupView",ops);
    }
	
	@RequiresPermissions(value="cmsContentGroupView:updateCmsContentGroupView",desc="内容用户组浏览配置更新")
    @RequestMapping(value="/updateCmsContentGroupView", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object updateCmsContentGroupView(CmsContentGroupView cmsContentGroupView){
		cmsContentGroupViewService.updateCmsContentGroupView(cmsContentGroupView);
		return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsContentGroupView:deletCmsContentGroupView",desc="内容用户组浏览配置删除")
    @RequestMapping(value="/deleteCmsContentGroupView", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object deleteCmsContentGroupView(Long id){
		cmsContentGroupViewService.deleteCmsContentGroupView(id);
		return ajaxDoneSuccess("数据操作成功 ");
    }

}